<!-- 
All rights Reserved, Designed By www.youyacao.com 
@Description:编辑收款信息
@author:成都市一颗优雅草科技有限公司     
@version V3.7 
注意：本前端源码遵循 MulanPSL-2.0开源协议（木兰宽松许可证）本内容仅限于个人参考，禁止用于其他的商业用途
需要商业用途或者定制开发等可访问songshu.youyacao.com   联系QQ:422108995 23625059584

 -->


<template>
	<view class="content">
		<view class="form-box">
			<view class="form-row">
				<view class="title">银行名称</view>
				<view class="input">
					<input v-model="allData.bank"  disabled="disabled" type="text" />
				</view>
			</view>
			
			<view class="form-row">
				<view class="title">开户银行</view>
				<view class="input">
					<input v-model="allData.bankname"  disabled="disabled" type="text" />
				</view>
			</view>
			
			<view class="form-row">
				<view class="title">开户名称</view>
				<view class="input">
					<input v-model="allData.name" type="text" />
				</view>
			</view>
			
			<view class="form-row">
				<view class="title">收款账号</view>
				<view class="input">
					<input v-model="allData.account" type="text" />
				</view>
			</view>
		</view>
		
		
		<view class="button-box">
			<button type="primary" @click="submitCard()">提交</button>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				allData:{
					id:'',
					bank:'支付宝',
					bankname:'支付宝',
					name:'',
					account:''
				}
			}
		},
		onLoad(data) {
			if(data.id){
				uni.setNavigationBarTitle({
					title:"修改银行卡信息"
				})
				this.getCardInfo(data.id);
			}
		},
		onShow() {
			
		},
		methods: {
			getCardInfo(id){
				this.$api.getCardinfo({id:id}).then((res)=>{
					if (res.data.code == 1) {
						uni.showToast({
							icon:"none",
							title: res.data.msg
						});
						return;
					}
					this.allData = res.data.data;
				})
			},
			submitCard(){
				uni.showLoading({
					mask:true,
					title:'正在提交...'
				});
				var method = this.allData.id ? this.$api.updateCardinfo : this.$api.addCardinfo;
				method(this.allData).then((res)=>{
					uni.hideLoading();
					if (res.data.code == 1) {
						uni.showToast({
							icon:"none",
							title: res.data.msg
						});
						return;
					}
					uni.showModal({
						title:"提示",
						content:res.data.msg,
						success() {
							uni.navigateBack({
								delta:1
							});
						}
					});
				})
			}
		}
	}
</script>

<style>
.content{
	padding-top: 40rpx;
}
.form-box{
	background: #FFFFFF;
	padding: 40rpx;
}
.form-row{
	display: flex;
	padding:20rpx 0px;
	font-size: 36rpx;
	align-items: center;
}
.form-row .title{
	color: #333333;
}
.form-row .input{
	margin-left: 20rpx;
}
.form-row .input input{
	width: 400rpx;
	border-radius: 40rpx;
	background:#D8D8D8;
	padding: 10rpx 40rpx;
}
.button-box{
	padding:40rpx;
}
</style>
